package com.jfinal.club.article;

import com.jfinal.aop.Before;
import com.jfinal.club._admin.article.ArticleAdminService;
import com.jfinal.club.common.controller.BaseController;
import com.jfinal.club.common.model.Article;
import com.jfinal.plugin.ehcache.CacheInterceptor;
import com.jfinal.plugin.ehcache.CacheName;

import java.util.List;

/**
 * @Auther: 10091
 * @Date: 2018-07-20 17:22
 * @Description: 文章数据 前台
 */
public class ArticleController extends BaseController {

    ArticleAdminService ser = ArticleAdminService.me;

    /**
     * 获取最新文章接口
     */
    @Before(CacheInterceptor.class)
    @CacheName("articleList")
    public void loadAll(){
        List<Article> articles = ser.findAll();
        renderJson(articles);
    }

}
